package com.yuxi.Dao.Impl;

import java.io.Serializable;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.yuxi.Dao.TaskDispatchDao;
import com.yuxi.Entity.TaskDispatch;


@Repository
public class TaskDispatchDaoImpl extends BaseDaoImpl<Serializable, Serializable> implements TaskDispatchDao {
	private Logger logger=LoggerFactory.getLogger(TaskDispatchDaoImpl.class);
	public TaskDispatchDaoImpl(){
		super(TaskDispatch.class);
	}
	@Override
	public TaskDispatch getDispatch(Integer tDispatchId) {
		// TODO Auto-generated method stub
		return (TaskDispatch) super.get(tDispatchId);
	}

	@Override
	public TaskDispatch addDispatch(TaskDispatch tDispatch) {
		// TODO Auto-generated method stub
		return (TaskDispatch) super.addAndReturn(tDispatch);
	}

	@Override
	public void deleteDispatch(TaskDispatch tDispatch) {
		// TODO Auto-generated method stub
		super.delete(tDispatch);
	}

	@Override
	public void modifly(TaskDispatch tDispatch) {
		// TODO Auto-generated method stub
		super.update(tDispatch);
	}
	@Override
	public List<TaskDispatch> getTaskDispatchByInfoId(int infoId, int state) {
		String hql="from TaskDispatch where informationId=? and status=? ";
		return super.find(hql, infoId,state);
	}
	@Override
	public List<TaskDispatch> getAll() {
		return super.find(" from  TaskDispatch");
	}
	@Override
	public List<TaskDispatch> getTaskDispatchByInfoId(int infoId) {
		String hql="from TaskDispatch where informationId=? ";
		return super.find(hql, infoId);
	}
	@Override
	public void delTimeOutInfoRecord(Integer infoId) {
		super.delete("delete from TaskDispatch where informationId=? and status =?", infoId,0);
		
	}
}
